package com.yohann.designPattern.iterator.college;

import com.yohann.designPattern.iterator.department.Department;
import com.yohann.designPattern.iterator.iterator.InfoCollegeIterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * <p>
 * 信息学院
 * </p>
 *
 * @author Yohann
 * @since 2021/2/12 16:13
 */
public class InfoCollege implements College {
    private List<Department> departments;

    public InfoCollege() {
        this.departments = new ArrayList<>();
        addDepartment("信息安全", "信息安全");
        addDepartment("网络安全", "网络安全");
        addDepartment("通信安全", "通信安全");
    }

    @Override
    public String getName() {
        return "info-college";
    }

    @Override
    public void addDepartment(String name, String description) {
        departments.add(new Department(name, description));
    }

    @Override
    public Iterator createIterator() {
        return new InfoCollegeIterator(departments);
    }
}